package leetcode;

/**
 * @Description
 * @Author away
 * @Version V1.0.0
 * @Since 1.0
 * @Date 21.5.6
 */

public class T1720 {
    public static void main(String[] args) {
        T1720 t = new T1720();
        int[] encoded = {1, 2, 3};
        int first = 1;
        System.out.println(t.decode(encoded, first));
    }

    public int[] decode(int[] encoded, int first) {
        int[] result = new int[encoded.length + 1];
        result[0] = first;
        for (int i = 0; i < encoded.length; i++) {
            result[i + 1] = result[i] ^ encoded[i];
        }
        return result;
    }
}
